// JORGE FERNANDO GOMEZ
// 1259371
// 189631
// LEC A1
// MARTIN MÜLLER
// D02
// YANG LIU


#ifndef FIGSTACK_H
#define FIGSTACK_H 1

#define MAXLEN_FIG      128

#include <string.h>     /* Included to make memwatch happy. */
#include "memwatch.h"

#include "util.h"

/* Properties is a struct to store
 * a particular figure's properties. */
struct Properties  {
    char figureName[MAXLEN_FIG+1];

    double x, y;
    double *dx, *dy;
    
    int drawCount;
    int isdefined;
};

/* FigStack is a struct to store figures. */
typedef struct {
    struct Properties * figProperties;

    int currSize;
    int figureCount;
} FigStack;

/* FigStacks is a struct to store figure stacks. */
struct FigStacks {
    FigStack * mystack;
    struct FigStacks * next;
};



/* See ./figStack.c for more information. */
/* FUNCTION PROTOTYPES */



/* Initializes a figure stack. */
void initstack ( FigStack * Figures, int length );

/* Adds a stack to stack list. */
void addStack ( FigStack * newFigStack );

/* Returns the stack list. */
struct FigStacks** getStackList ( void );

/* Destroys the stack list. */
void destroyStackList ( void );



/* Adds space for a new figure in the stack. */
void addFig ( FigStack * Figures, char * localFigName );

/* Initializes a figure. */
void initfig ( FigStack * Figures, char * figName );

/* Updates information in Figures using parameters found in string. */
void updatefig ( char * string, FigStack * Figures, int position, int type );

/* Adds space for new draw commands. */
void plusOneDraw ( FigStack * Figures, int position );

/* Retrieves the index of nameString inside Figures. */
int getFigIndex ( char * nameString, FigStack * Figures );

/* Finds if nameString exists inside Figures structure. */
int figexists ( char * nameString, FigStack * Figures );

/* Resets memory in Figures at position to reset. */
void clearfig ( FigStack * Figures, int position, double reset );

/* Adds space for more figures in the stack. */
void extendFigStack ( FigStack * Figures );

/* Frees memory used by the stack. */
void destroyFigStack ( FigStack * Figures );

#endif /* End of include guard: FIGSTACK_H */
